package doh.util;

import java.io.Serializable;

/*
 * Bookeeping class for statistics of a RPS match between two players
 */
public class GameSessionDetails implements Serializable {
    GamePlayer player1;
    GamePlayer player2;
    boolean winner;

    /*
     * Constructor, initializes instance of GameSessionDetails with the participating players
     */
    public GameSessionDetails(GamePlayer p1, GamePlayer p2) {
        player1 = p1;
        player2 = p2;
    }

    /*
     * Alternative constructor, initializes instance of GameSessionDetails with a winner
     */
    public GameSessionDetails(GamePlayer p1, GamePlayer p2, boolean w) {
        player1 = p1;
        player2 = p2;
        winner = w;
    }

    /**
     * Accessor function for a player
     * @return player1's GamePlayer object
     */
    public GamePlayer getPlayer1() {
        return player1;
    }

    /**
     * Accessor function for a player
     * @return player2's GamePlayer object
     */
    public GamePlayer getPlayer2() {
        return player2;
    }

    /**
     * Sets the winner of a GameSessionDetail
     * @param win, true = player1 wins; false = player2 wins
     */
    public void changeWinner(boolean win) {
        winner = win;
    }

    /**
     * Accessor function for the winner of the match
     * @return the winner of the match
     */
    public boolean getWinner() {
        return winner;
    }
}
